﻿
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<input type="hidden" id="hdnpage" />

<script type="text/javascript">
    $().ready(function () {
        $("#hdnpage").val(1);
    });

    function LoadDataRecord() {
        $('div#loading').html('<p><img src="/Images/Design/loading.gif" style="width:100%; height:25px;position:relative;"></p>');

        $.ajax({
            type: 'Get',
            url: '@Url.Action("GetRagcomicDataContract", "Home")',
            data: { page: parseInt($("#hdnpage").val()) + 1 },
            async: false,
            dataType: "html",
            success: function (data) {
                if (data != '') {
                    $("#lblcomic").append(data);
                    $("#hdnpage").val(parseInt($("#hdnpage").val()) + 1);
                }
            },
            error: function (xhr, ajaxOptions, thrownError) {
                //alert(xhr.status);
                //alert(thrownError);

            }
        });
        $('div#loading').empty();
    }

    $(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {

            LoadDataRecord();
        }
    });
</script>

<div class="frame-content">
    <div id="lblcomic">
         @Html.Partial("ComicPartial")
    </div>
    <div id="loading"></div>
</div>